//
//  todayListTimeLineTableViewCell.m
//  Cup
//
//  Created by dllo on 15/4/23.
//  Copyright (c) 2015年 doll. All rights reserved.
//

#import "todayListTimeLineTableViewCell.h"
#define WIDTH self.contentView.frame.size.width
@implementation todayListTimeLineTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.headLabel = [[UILabel alloc] init];
        self.headLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.headLabel];
        [self.headLabel release];
        
        self.timeLineImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.timeLineImageView];
        [self.timeLineImageView release];
        
        self.introduceLabel = [[UILabel alloc] init];
        self.introduceLabel.font = [UIFont systemFontOfSize:15];
        self.introduceLabel.numberOfLines = 3;
        [self.contentView addSubview:self.introduceLabel];
        [self.introduceLabel release];
        
        self.likeImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.likeImageView];
        [self.likeImageView release];
        
        self.likeLabel = [[UILabel alloc] init];
        self.likeLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.likeLabel];
        [self.likeLabel release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.headLabel.frame = CGRectMake(30, 10, WIDTH, 20);
    
    CGFloat picheight = self.timeLineImageView.image.size.height * (self.contentView.frame.size.width - 60) / (self.timeLineImageView.image.size.width + 0.1);
    self.timeLineImageView.frame = CGRectMake(30, 38, self.contentView.frame.size.width - 60, picheight);
    
    self.introduceLabel.frame = CGRectMake(30, 45 + picheight, WIDTH - 60, 70);
    
    UIImage *likeImage = [UIImage imageNamed:@"like"];
    self.likeImageView.image = likeImage;
    self.likeImageView.frame = CGRectMake(0.693 * WIDTH, 130 + picheight, 18, 18);
    
    self.likeLabel.frame = CGRectMake(0.7653 * WIDTH, 130 + picheight, 60, 18);
}

- (void)dealloc
{
    [_headLabel release];
    [_timeLineImageView release];
    [_introduceLabel release];
    [_likeImageView release];
    [_likeLabel release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
